from rest_framework import serializers

from goods.models import GoodsChannelGroup, GoodsChannel


class GoodsChannelSerializer(serializers.ModelSerializer):
    # 嵌套序列化返回
    group = serializers.StringRelatedField(read_only=True)
    category=serializers.StringRelatedField(read_only=True)
    group_id=serializers.IntegerField()
    category_id = serializers.IntegerField()
    class Meta:
         model=GoodsChannel
         fields = '__all__'

class GoodsChannelGroupSerializer(serializers.ModelSerializer):
    class Meta:
        model = GoodsChannelGroup
        fields = '__all__'

